<template>
<h2>{{$store.state.username}}</h2>
<button @click="btn"></button>
<button @click="btnsyc"></button>
</template>

<script>
import { useStore } from 'vuex'
export default {
  setup () {
    const store = useStore()
    // console.log(store)
    const btn = () => {
      store.commit('yayaFn', '小帅')
    }
    const btnsyc = () => {
      store.dispatch('setname')
    }
    return { btn, btnsyc }
  }
}
</script>

<style>

</style>
